#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 25 + 5;

int n, k, m;
int vis[N];
void go(int& x, int t, int d) {
  while (t--) {
    do {
      x += d;
      if (x > n) x -= n;
      if (x < 1) x += n;
    } while (vis[x]);
  }
}
void solve() {
  rep(i, 0, n + 1) vis[i] = 0;
  int x = n, y = 1;
  int cnt = n;
  while (cnt) {
    go(x, k, 1), go(y, m, -1);
    vis[x] = vis[y] = 1;
    if (x == y) {
      cnt--;
      cout << setw(3) << x;
    } else {
      cnt -= 2;
      cout << setw(3) << x << setw(3) << y;
    }
    if (cnt)
      cout << ',';
    else
      cout << endl;
  }
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  while (cin >> n >> k >> m) {
    if (!n) break;
    solve();
  }
  return 0;
}